package com.zzyl.mapper;


import com.github.pagehelper.Page;
import com.zzyl.dto.NursingPlanDto;
import com.zzyl.dto.NursingProjectPlanDto;
import com.zzyl.entity.NursingPlan;
import com.zzyl.entity.NursingProjectPlan;
import com.zzyl.vo.NursingPlanVo;
import com.zzyl.vo.NursingProjectPlanVo;
import org.apache.ibatis.annotations.*;

import java.util.List;

@Mapper
public interface NursingPlanMapper {

    @Select("select * from nursing_plan")
    List<NursingPlanVo> all();


    Page<NursingPlanVo> list(String name, Integer status);


    void add(NursingPlan nursingPlan);

    void addList(List<NursingProjectPlanDto> projectPlans);


    @Select("select * from nursing_plan where id=#{id}")
    NursingPlanVo findByid(Long id);


    @Select("select t1.*,t2.name as projectName from nursing_project_plan as t1,nursing_project as t2 where t1.plan_id=#{id} and t1.project_id = t2.id")
    List<NursingProjectPlan> Byid(Long id);


    void updata(NursingPlan plan);


    @Delete("DELETE  from nursing_plan where id=#{id}")
    void delete(Long id);

    @Delete("DELETE  from nursing_project_plan where plan_id=#{id}")
    void deleteId(Long id);

    @Update("update nursing_plan set status = #{status} where id = #{id}")
    void updateStatus(Long id, Integer status);

    @Delete("delete from nursing_project_plan where plan_id=#{id}")
    void baseDelete(Long id);
}
